package org.redis.cluster.config.support;

import org.redis.cluster.config.ConfigLoader;
import org.redis.cluster.config.RegistryConfig;
import org.redis.cluster.config.ServerConfig;
import org.redis.cluster.config.exception.ConfigException;

public abstract class AbstractConfigLoader implements ConfigLoader {

	@Override
	public ServerConfig loadServerConfig() {
		try {
			return doLoadServerConfig();
		}
		catch(Exception e) {
			throw new ConfigException(e);
		}
	}

	@Override
	public RegistryConfig loadRegistryConfig() {
		try {
			return doLoadRegistryConfig();
		}
		catch(Exception e) {
			throw new ConfigException(e);
		}
	}

	/**
	 * 
	 * @return
	 * @throws Exception
	 */
	protected abstract ServerConfig doLoadServerConfig() throws Exception;
	
	/**
	 * 
	 * @return
	 * @throws Exception
	 */
	protected abstract RegistryConfig doLoadRegistryConfig() throws Exception;
}